package com.ofps.web.controller.flow;

import com.alibaba.fastjson.JSONObject;
import com.ofps.common.core.domain.AjaxResult;
import com.ofps.common.exception.ServiceException;
import com.ofps.flow.service.IEnterFlowInfoInstService;
import com.ofps.forms.service.QuestionBlankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/flowQuestion")
public class FlowQuestionController {

    @Autowired
    private QuestionBlankService questionBlankService;


    /**
     * 获取表单和问题接口
     * @param jsonObject 请求参数
     * @return 表单和问题数据
     */
    @PostMapping("/getQuestionInfo")
    public AjaxResult getQuestionInfo(@RequestBody JSONObject jsonObject) {
        if (jsonObject.getString("formId") == null) {
            throw new ServiceException("请求参数缺失, 请检查~");
        }
        return AjaxResult.success(questionBlankService.getQuestionInfo(jsonObject));
    }
}
